using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_Purview - 具体权限表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysPurview<T> :ModelBase<SysPurview> where T : SysPurview, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.PurviewID = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return PurviewID;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.PurviewID=dy.PurviewID;
           this.Title=dy.Title;
           this.ParentId=dy.ParentId;
           this.Path=dy.Path;
        } 

        #region 定义属性

     
         /// <summary>
        /// 权限ID
        /// </summary>
        private int _PurviewID =int.MinValue;
      
        /// <summary>
        /// 权限ID
        /// </summary>
        public int PurviewID
        {
            get 
            {
              return   (this._PurviewID); 
            }

            set 
            {
                    _PurviewID= value;  
            }
        }
       
     
         /// <summary>
        /// 名称
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 名称
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 上级权限
        /// </summary>
        private int _ParentId =int.MinValue;
      
        /// <summary>
        /// 上级权限
        /// </summary>
        public int ParentId
        {
            get 
            {
              return   (this._ParentId); 
            }

            set 
            {
                    _ParentId= value;  
            }
        }
       
     
         /// <summary>
        /// 路径
        /// </summary>
        private String _Path = "";
      
        /// <summary>
        /// 路径
        /// </summary>
        public String Path
        {
            get 
            {
              return   (this._Path); 
            }

            set 
            {
                    _Path= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(SysPurview info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["PurviewID"]!= DBNull.Value)
                  {
                  info.PurviewID=Convert.ToInt32(row["PurviewID"]);
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["ParentId"]!= DBNull.Value)
                  {
                  info.ParentId=Convert.ToInt32(row["ParentId"]);
                 }
                 
                  
                  if(row["Path"]!= DBNull.Value)
                  {
                  info.Path=row["Path"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysPurview info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@PurviewID", DbType.Int32,ParameterTool.GetObj( info._PurviewID )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@ParentId", DbType.Int32,ParameterTool.GetObj( info._ParentId )); 
            
             
                cn.AddInParameter(comm, "@Path", DbType.String,ParameterTool.GetObj( info._Path )); 
            
        } 

    } 
} 